﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Zxb.DayWork.Logic;

namespace Zxb.DayWork.Test
{
    public class BatchWorkerTest
    {
        //static void Main(string[] args)
        //{
        //    //Zxb.DayWork.Logic.HomeWorkUpdateHitsWorker h = new Zxb.DayWork.Logic.HomeWorkUpdateHitsWorker();
        //    //h.Run();

        //    //BatchLoopWorkerTest.RunTest();
        //    //BatchWorkerTest.RunTest();

        //    //TotalCaseNumTest();

        //    //HitDeleteTest();

        //    //StatDealerWorkerTest();

        //    //DealerHitWorkerTest();

        //    MonthWeekDayTest();

        //    Console.ReadLine();
        //}

        public static void RunTest()
        {
            CityIDWorkerTest();
            ClickHitTest();
            PriceTest();
            NewHouseHitTest();
            TotalCaseNumTest();
            TotalHitTest();
            TotalClickTest();
            BBSTest();
            
        }

        private static void BBSTest()
        {
            BBSWorker worker = new BBSWorker(1000);
            worker.Run();
        }

        private static void TotalClickTest()
        {
            TotalClickWorker worker = new TotalClickWorker(DateTime.Now);
            worker.Run();
        }

        private static void TotalHitTest()
        {
            TotalHitWorker worker = new TotalHitWorker(DateTime.Now);
            worker.Run();
        }

        private static void ClickHitTest()
        {
            ClickWorker c = new ClickWorker(DateTime.Now.AddDays(-4.0), DateTime.Now.AddDays(-1.0));
            c.Run();

            for (int i = -4; i < 0; i++)
            {
                HitWorker hit = new HitWorker(DateTime.Now.AddDays(i));
                hit.Run();
            }
        }

        private static void PriceTest()
        {
            PriceSyncWorker price = new PriceSyncWorker(0);
            price.Run();
            price = new PriceSyncWorker(1);
            price.Run();
        }

        private static void NewHouseHitTest()
        {
            HitsSyncWorker hit = new HitsSyncWorker(0);
            hit.Run();
            hit = new HitsSyncWorker(1);
            hit.Run();
        }

        private static void CityIDWorkerTest()
        {
            CityIDWorker city = new CityIDWorker();
            city.Run();
        }

        private static void TotalCaseNumTest()
        {
            TotalCaseNum t = new TotalCaseNum();
            t.Run();
            ////select top 10 TotalNewCaseNum from EstateManage with(nolock) order by TotalNewCaseNum desc
        }

        private static void HitDeleteTest()
        {
            HitDeleteWorker worker = new HitDeleteWorker();
            worker.Run();
        }

        private static void StatDealerWorkerTest()
        {
            //StatDealerWorker w = new StatDealerWorker(-1);
            //w.Run();

            for (int i = -20; i < 0; i++)
            {
                StatDealerWorker w = new StatDealerWorker(i);
                w.Run();
            }
        }

        private static void DealerHitWorkerTest()
        {
            //DealerHitWorker w = new DealerHitWorker();
            //w.Run();

            for (int i = -40; i < -10; i++)
            {
                DealerHitWorker w = new DealerHitWorker(i);
                w.Run();
            }
        }

        private static void MonthWeekDayTest()
        {
            MonthWeekDayHitWorker w = new MonthWeekDayHitWorker();
            w.Run();
        }
    }
}
